<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<html:header title="商品套餐打印">

    <style media="print">
        @page {
            margin: 0mm; /* this affects the margin in the printer settings */
            size: landscape;
        }
    </style>
    <style>
        table{border-collapse: collapse;width: 100%}
        table td, table th{border: 1px solid #000000;}
        table td{padding:4px 0 4px 4px;}
        table td, table th{border: 1px solid #000000;}
        span,div,td,th{font-size:14px;}
    </style>

    <script>
        function printPage(data) {
            let $printDiv = $("#printDiv");
            $printDiv.empty();

            genPrintDiv($printDiv, data.id, "商品套餐", data.no);

            let beforeList = [];
            beforeList.push({label:"名称", content:data.name});
            beforeList.push({label:"状态", content:data.status == 1?"启用":"停用"});
            genPrintLine($('#'+data.id+' .before'), beforeList);

            let endList = [];
            endList.push({newLine:true, label:"套餐售价", content:getPrice(data.price)});
            endList.push({label:"备注", content:data.remark});
            genPrintLine($('#'+data.id+' .end'), endList);

            let list=[];
            $.each(data.packetGoodsVoList, function (i,vo) {
                let goods = vo.goodsVo;
                let data={};
                data.index = (i+1);
                data.no = goods.no;
                data.name = goods.name;
                data.norms =genGoodsNorm(goods.norms);
                data.attr = genAttr(goods.attrNameVoList);
                data.number = goods.number;
                data.unit = genUnitName(goods.goodsUnitVoList,goods.unitId);
                data.price = genPriceName(goods.goodsUnitVoList,goods.unitId,goods.priceFlag);
                data.amount = goods.amount;
                list.push(data);
            });

            genPrintTable($('#'+data.id+' .table'), ['序号','商品编号','商品名称','规格','属性','数量','单位','单价','金额'],list);
            window.print();
        }
    </script>

</html:header>
<body>
<div id="printDiv"></div>
</body>
</html>